﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using Newtonsoft.Json;
using RN.ERP.Web.BzkModelService;
using System.Configuration;
using System.Collections;

namespace RN.ERP.Web.UserControl
{
    public partial class UCProjectProof : System.Web.UI.UserControl
    {
        private ProjectService.ProjectServiceClient client = new ProjectService.ProjectServiceClient();
        public string FtpUrl = ConfigurationManager.AppSettings["FtpUrl"].ToString();
        public Hashtable ProofTable = new Hashtable();

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void BindProofList(int projectID)
        {
            try
            {
                string resultStr = client.GetProofByProjectID(projectID, "02");
                List<BzkProof> proofList = JsonConvert.DeserializeObject<List<BzkProof>>(resultStr);

                string proofLink = "";
                if (proofList != null && proofList.Count > 0)
                {
                    foreach (var p in proofList)
                    {
                        if (!ProofTable.ContainsKey(p.ProofType))
                        {
                            proofLink = p.AttachId == null ? "" : p.AttachId.ToString() + p.FileExtession;
                            ProofTable.Add(p.ProofType, proofLink);
                        }
                    }
                }
            }
            catch (Exception)
            { }
        }
    }
}